#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ----------------------------------------------------------------------------

# ----------------------------------------------------------------------------
# Script to upload a package description to the universe
#
# Required applications:
# ------------------
#   mvn - software project management for Java
#   sbaz - Scala system to share files
# ----------------------------------------------------------------------------


PACKAGE="scalashell-scala"
VERSION=0.1
TMP=target/sbaz
BAZAAR="http://jweslley.googlecode.com/svn/scala-bazaar/"

echo "Creating jar..."
mvn package 1> /dev/null

echo "Cleaning..."
rm -rf $TMP/
mkdir -p $TMP/bin
mkdir -p $TMP/lib

echo "Copying files..."
cp scripts/scalash $TMP/bin/
cp target/${PACKAGE}-${VERSION}.jar $TMP/lib/

echo "Packing..."
sbaz pack ${PACKAGE} $TMP/ --version ${VERSION} --depends scalashell-library --outdir target --linkbase $BAZAAR

echo "Sharing file..."
sbaz share ${PACKAGE}-${VERSION}.advert

rm ${PACKAGE}-${VERSION}.advert

echo "Done."